package com.itheima.controll;

import com.aliyun.oss.AliOSSUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;

@RestController
public class UploadController {
    @Autowired
    private AliOSSUtils aliOSSUtils;

    @PostMapping("/autoupload")
    public String upload(MultipartFile image) throws IOException {
        String url = aliOSSUtils.upload(image);
        System.out.println("自动配置成功");
        return url;
    }
}
